<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>查看评分表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
        <script type="text/javascript" src="./js/jquery.min.js"></script>
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
        <style type="text/css">
        	.layui-input-block input{
        		width:25%;
        	}
        	.layui-input-block input{
        		float: left;
        	}
        </style>
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                <form id="form" method="get">
                    <div class="layui-card">
                        <div class="layui-card-body layui-table-body layui-table-main">
                            <table class="layui-table layui-form">
                                <tbody>
                                	<c:forEach items="${Mark}" var="item">
                                  <tr>
                                  	<td>${item.ma_kind}</td>
                                  </tr>	
                                  <tr>
                                  	<th>
						                <div class="layui-input-block" style="display:flex;justify-content:space-around;">
						                    <input type="radio" name="Mark${item.ma_order}" value="A" title="${item.getA()}">
						                    <input type="radio" name="Mark${item.ma_order}" value="B" title="${item.getB()}">
						                    <input type="radio" name="Mark${item.ma_order}" value="C" title="${item.getC()}">
						                    <input type="radio" name="Mark${item.ma_order}" value="D" title="${item.getD()}">
						                    <input type="hidden" name="ma_score${item.ma_order}" value="${item.ma_score}">
						                    <input type="hidden" name="ma_id${item.ma_order}" value="${item.ma_id}">
						                </div>
						            </th>
                                  </tr>
                                  </c:forEach>
                                </tbody>
                            </table> 
                        </div>
                    </div>
                    <!-- 获取集合中的长度 -->
                    <input type="hidden" name="ma_order" value="${fn:length(Mark)}">
                   	<input type="hidden" name="te_id" value="${te_id}">
                    <div class="layui-form-item">
		                <div class="layui-input-block buttonOne">
		                    <button class="btn layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
		                    <button type="reset" class="layui-btn layui-btn-normal">重置</button>
		                </div>
		            </div>
		            </form>
                </div>
            </div>
        </div> 
    </body>
    <script>
      layui.use(['form'], function(){
        var  form = layui.form;
        // 监听全选
        form.on('checkbox(checkall)', function(data){
          if(data.elem.checked){
            $('tbody input').prop('checked',true);
          }else{
            $('tbody input').prop('checked',false);
          }
          form.render('checkbox');
        });    
      });
      $(function () {       
    		$(".btn").click( function () {
    			var url="${pageContext.request.contextPath}/submitTeMark";
    			var param=$("#form").serialize();
    			$.post(url,param,function(data){
    			 	if(data.flag==0){
    					alert(data.msg);
    				}
    				if(data.flag==1){
    					window.parent.location.reload();//刷新父页面
    			        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    			        parent.layer.close(index);
    			        alert(data.msg);
    				} 
    			});
    		});
        });
    </script>
</html>